package com.zxn.ssyx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zxn.ssyx.mapper.AdminMapper;
import com.zxn.ssyx.model.acl.Admin;
import com.zxn.ssyx.service.AdminService;
import com.zxn.ssyx.vo.acl.AdminQueryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminServiceImpl extends ServiceImpl<AdminMapper, Admin> implements AdminService {
    @Autowired
    private AdminMapper adminMapper;
    @Override
    public IPage<Admin> index(Page<Admin> pageParam, AdminQueryVo adminQueryVo) {
        LambdaQueryWrapper<Admin> lqw = new LambdaQueryWrapper<>();
        if (adminQueryVo.getName() != null){
            lqw.like(Admin::getName,adminQueryVo.getName());
        }
        return adminMapper.selectPage(pageParam,lqw);
    }
}
